<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="订单编号" prop="orderNum">
        <el-input
            v-model="queryParams.orderNum"
            placeholder="请输入订单编号"
            clearable
            @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="付款人id" prop="payerId">
        <el-input
            v-model="queryParams.payerId"
            placeholder="请输入付款人id"
            clearable
            @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="付款单号" prop="payOrderNum">
        <el-input
            v-model="queryParams.payOrderNum"
            placeholder="请输入付款人id"
            clearable
            @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="退款账户" prop="account">
        <el-input
            v-model="queryParams.account"
            placeholder="请输入退款账户"
            clearable
            @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="支付方式" prop="method">
        <el-select v-model="queryParams.method" placeholder="支付方式" clearable>
          <el-option label="支付宝" value="支付宝"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

<!--    <el-row :gutter="10" class="mb8">-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--            type="primary"-->
<!--            plain-->
<!--            icon="el-icon-plus"-->
<!--            size="mini"-->
<!--            @click="handleAdd"-->
<!--            v-hasPermi="['system:post:add']"-->
<!--        >新增</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--            type="success"-->
<!--            plain-->
<!--            icon="el-icon-edit"-->
<!--            size="mini"-->
<!--            :disabled="single"-->
<!--            @click="handleUpdate"-->
<!--            v-hasPermi="['system:post:edit']"-->
<!--        >修改</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--            type="danger"-->
<!--            plain-->
<!--            icon="el-icon-delete"-->
<!--            size="mini"-->
<!--            :disabled="multiple"-->
<!--            @click="handleDelete"-->
<!--            v-hasPermi="['system:post:remove']"-->
<!--        >删除</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--            type="warning"-->
<!--            plain-->
<!--            icon="el-icon-download"-->
<!--            size="mini"-->
<!--            @click="handleExport"-->
<!--            v-hasPermi="['system:post:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
<!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getPay"></right-toolbar>-->
<!--    </el-row>-->

    <el-table v-loading="loading" :data="pays" @selection-change="handleSelectionChange">
      <el-table-column type="index" label="序号" width="50"></el-table-column>
      <el-table-column label="退款账户" align="center" prop="account" />
      <el-table-column label="退款方式" align="center" prop="method" />
      <el-table-column label="订单编号" align="center" prop="orderNum" />
      <el-table-column label="付款人id" align="center" prop="payerId" />
      <el-table-column label="退款金额" align="center" prop="price" width="60"/>
      <el-table-column label="付款单号" align="center" prop="payOrderNum" />
      <el-table-column label="退款时间" align="center" prop="succeedTime" />
<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button-->
<!--              size="mini"-->
<!--              type="text"-->
<!--              icon="el-icon-view"-->
<!--              @click="handleView(scope.row,scope.index)"-->
<!--              v-hasPermi="['monitor:operlog:query']"-->
<!--          >订单详细</el-button>-->
<!--          <el-button-->
<!--              size="mini"-->
<!--              type="text"-->
<!--              icon="el-icon-delete"-->
<!--              @click="handleDelete(scope.row)"-->
<!--              v-hasPermi="['system:post:remove']"-->
<!--          >操作记录</el-button>-->
<!--          <el-button-->
<!--              size="mini"-->
<!--              type="text"-->
<!--              icon="el-icon-delete"-->
<!--              @click="handleDelete(scope.row)"-->
<!--              v-hasPermi="['system:post:remove']"-->
<!--          >取消订单</el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>

    <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.currentPage"
        :limit.sync="queryParams.pageSize"
        @pagination="getPay"
    />


<!--    &lt;!&ndash; 查看用户详情 &ndash;&gt;-->
<!--    &lt;!&ndash; 操作日志详细 &ndash;&gt;-->
<!--    <el-dialog title="退款详细信息" :visible.sync="open" width="800px" append-to-body>-->
<!--      <el-form ref="form" :model="form" label-width="100px" size="mini">-->
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="退款人昵称：">{{ form.nickname }} </el-form-item>-->
<!--            <el-form-item-->
<!--                label="退款人姓名：">{{ form.realName }}  </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="手机号：">{{ form.phone }}</el-form-item>-->
<!--            <el-form-item label="身份证号：">{{ form.idCardNumber }}</el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="总数：">{{ form.receivedOrderSum }}</el-form-item>-->
<!--            <el-form-item label="总金额：">{{ form.totalAmount }}</el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
<!--      </el-form>-->
<!--      <div slot="footer" class="dialog-footer">-->
<!--        <el-button @click="open = false">关 闭</el-button>-->
<!--      </div>-->
<!--    </el-dialog>-->


  </div>
</template>

<script>
// import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
import {loadRefund,getPayDetail} from "@/api/pay/pay";

export default {
  name: "Post",
  dicts: ['sys_normal_disable'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,

      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 岗位表格数据
      postList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        currentPage: 1,
        pageSize: 10,
        nickName: undefined,
        payStatus: undefined,
        phone: undefined,
        workerLevel: undefined
      },
      // 表单参数
      form: {},
      pays: [],
      // 表单校验
      rules: {
        postName: [
          { required: true, message: "岗位名称不能为空", trigger: "blur" }
        ],
        postCode: [
          { required: true, message: "岗位编码不能为空", trigger: "blur" }
        ],
        postSort: [
          { required: true, message: "岗位顺序不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getPay();
  },
  methods: {
    /** 查询拉黑订单列表 */
    getPay() {
      this.loading = true;
      loadRefund(this.queryParams).then(response => {
        console.log(response.data.rows)
        console.log(response.data.total)
        this.pays = response.data.rows;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        postId: undefined,
        postCode: undefined,
        postName: undefined,
        postSort: 0,
        status: "0",
        remark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getPay();
    },
    /** 详细按钮操作 */
    handleView(row) {
      console.log(row)
      this.open = true;
      this.form = row;
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.postId)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加岗位";
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/post/export', {
        ...this.queryParams
      }, `post_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
